
#include "StartScreen.h"
#include "GameScreen.h"
#include "OptionsScreen.h"
#include "DirectXEngine.h"



StartScreen::StartScreen()
{
	menu.AddMenuItem(L"New Game");
	menu.AddMenuItem(L"Options");
	menu.AddMenuItem(L"High Scores");
	menu.AddMenuItem(L"Quit");
}

StartScreen::~StartScreen()
{
	scene->Release();
}

void StartScreen::Draw()
{
	Screen::Draw(); // Call the super class

	menu.DrawMenu();
	

}

void StartScreen::Update(double frameTime)
{
	Screen::Update(frameTime);

	Controls * controls = Controls::Instance();

	BYTE pressedKey;

	pressedKey = controls->GetPressedKey();

	if ( pressedKey == DIK_SPACE || pressedKey == DIK_RETURN )
	{
		if( menu.GetSelectedItem().compare(L"New Game") == 0 )
			ScreenManager::Instance()->ChangeScreen(new GameScreen());
		else if( menu.GetSelectedItem().compare(L"Quit") == 0 )
			PostMessageW(CDirectXEngine::Instance()->windowHandle, WM_QUIT, NULL,NULL); //dont know if this is the best way but it works
		else if( menu.GetSelectedItem().compare(L"Options") == 0 )
			ScreenManager::Instance()->ChangeScreen(new OptionsScreen());
		//{}
		//else if( menuPosition == 3 )
		//{}
	}
	else if( pressedKey == DIK_UP )
	{
		menu.MoveUp();
	}
	else if( pressedKey == DIK_DOWN )
	{
		menu.MoveDown();
	}
	
}

